<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Administrator
 * Date: 12-9-5
 * Time: 下午1:34
 * To change this template use File | Settings | File Templates.
 */
class tools extends MY_Model
{
    /**
     * 获取更新资源
     *
     * @return mixed
     */
    public function getUpdateResource()
    {
        $this->db->select('id');
        $this->db->from('movie');
        $this->db->where('update_time >= ', date('Y-m-d').' 00:00:00');

        return $this->db->get()->result_array();
    }

    /**
     * 获取simplecd资源链接
     *
     * @param string $field
     * @param int $limit
     * @param int $offset
     * @param null $where
     * @param null $order
     * @return mixed
     */
    public function getSimpleCdLinkList($field = '*', $limit = 20, $offset = 0, $where = null, $order = null)
    {
        $this->db->select($field)->from('simplecd_link');
        $where && $this->db->where($where);
        $order && $this->db->order_by($order);
        $this->db->limit($limit, $offset);

        return $this->db->get()->result_array();
    }

    /**
     * 获取simplecd资源下载链接
     *
     * @param string $field
     * @param int $limit
     * @param int $offset
     * @param null $where
     * @param null $order
     * @return mixed
     */
    public function getSimpleCdDownloadLinkList($field = '*', $limit = 20, $offset = 0, $where = null, $order = null)
    {
        $this->db->select($field)->from('simplecd_download_list');
        $where && $this->db->where($where);
        $order && $this->db->order_by($order);
        $this->db->limit($limit, $offset);

        return $this->db->get()->result_array();
    }
}
